$(function() {

    log = console.log;

    formComplete = function() {

        $("#question").unmask();
        alert(API.Data.lang['dtl_posting_thanks'] + ".");
        return false;

    }

    formSubmit = function(form) {

        $('#question button').attr('disabled', 'disabled');
        $("#question").mask(API.Data.lang['dtl_posting_question'] + "...");
        form = $('#question_form');
        accomm_id = $('#hotel_id').val();
        var serialize = form.serialize();
        
        $.ajax({
            url: lang_url + '/question/accom-' + accomm_id + '?' + serialize + '&ajax=true',
            method: 'get',
            success: formComplete
        });
        return false;
    }

    $('#question_form').validate({
        errorElement: "em",
        submitHandler: formSubmit
    });
});


